import java.util.Scanner;

public class Main1633 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int a=sc.nextInt();
        int x=a%3;
        if (x==0){
            System.out.println("yes");
        }else
            System.out.println("no");
    }
}
